home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / WIN / VB_DB / PROFIT.ZIP / GRAPHMIX.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1993-04-12  |  7.5 KB  |  207 lines

  1. VERSION 2.00
  2. Begin Form GraphMix 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Graph Sales Mix"
  5.    ControlBox      =   0   'False
  6.    Height          =   6030
  7.    Left            =   1515
  8.    LinkTopic       =   "GraphMix"
  9.    MaxButton       =   0   'False
  10.    MinButton       =   0   'False
  11.    ScaleHeight     =   5625
  12.    ScaleWidth      =   5385
  13.    Top             =   1470
  14.    Width           =   5505
  15.    Begin GRAPH Graph1 
  16.       ColorData       =   GRAPHMIX.FRX:0000
  17.       ExtraData       =   GRAPHMIX.FRX:0002
  18.       FontFamily      =   GRAPHMIX.FRX:0004
  19.       FontSize        =   GRAPHMIX.FRX:0008
  20.       FontStyle       =   GRAPHMIX.FRX:0012
  21.       GraphData       =   GRAPHMIX.FRX:0016
  22.       GraphType       =   2  '3D Pie
  23.       Height          =   4965
  24.       LabelText       =   GRAPHMIX.FRX:001A
  25.       Left            =   135
  26.       LegendText      =   GRAPHMIX.FRX:001C
  27.       PatternData     =   GRAPHMIX.FRX:001E
  28.       SymbolData      =   GRAPHMIX.FRX:0020
  29.       TabIndex        =   1
  30.       Top             =   585
  31.       Width           =   5160
  32.       XPosData        =   GRAPHMIX.FRX:0022
  33.    End
  34.    Begin CommandButton Command1 
  35.       Caption         =   "Cancel"
  36.       Height          =   495
  37.       Left            =   4095
  38.       TabIndex        =   0
  39.       Top             =   45
  40.       Width           =   1215
  41.    End
  42. Sub Command1_Click ()
  43.   PrintCancelFlag = True
  44. End Sub
  45. Sub Form_Activate ()
  46.   Unload SalesMix
  47.   PrintRoutine
  48. End Sub
  49. Sub PrintRoutine ()
  50.     t% = DoEvents()
  51.     On Local Error GoTo ErrorRoutine
  52.     PageNo% = 0
  53.     TotalRetail& = 0
  54.     TotalCost& = 0
  55.     Printer.FontName = RTrim(CfgRec.FontName)
  56.     Printer.FontSize = CfgRec.FontSize
  57.     MaximumY& = (Printer.ScaleHeight - 1500)
  58.     PrintingCancelFlag = False
  59.     Print "Deli Menu System"
  60.     Print "Calculating...Please Wait..."
  61.    'Begin First Pass
  62.    'This pass is to get the totals before printing the report.
  63.     t% = DoEvents()
  64.     FirstSalesMix
  65.     If SalesMixSt% <> 0 Then
  66.       MsgUnknownSalesMixError
  67.     End If
  68.     Do
  69.       ExtCost& = 0
  70.       ExtRetail& = 0
  71.       RecipeCost = 0
  72.       RecipeRec.RecNo = SalesMixRec.RecNo
  73.       ReadRecipe
  74.       'Get lines of ingredients
  75.       RecipeDetRec.RecDetKey = RecipeRec.RecNo + String$(15, "0")
  76.       GetGERecipeDet
  77.       If RecipeDetSt% <> 9 And RecipeDetSt% <> 0 Then
  78.         MsgUnknownRecipeDetError
  79.         GoTo ExitProgram
  80.       End If
  81.       Do Until RecipeDetSt% <> 0 Or RecipeDetRec.RecDetKey > RecipeRec.RecNo + String$(15, "Z")
  82.           IngredientRec.IngKey = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  83.           ReadIngredient
  84.           If IngredientSt% = 0 Then
  85.             PrIngred$ = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  86.             PrNoUnits# = RecipeDetRec.RecDetQty
  87.             GoSub ProcessOneIngredient
  88.           End If
  89.           t% = DoEvents()
  90.           NextRecipeDet
  91.       Loop
  92.       ExtRetail& = RecipeRec.RecRetail * SalesMixRec.ServingsSold
  93.       UnitCost& = RecipeCost / RecipeRec.Servings
  94.       ExtCost& = UnitCost& * SalesMixRec.ServingsSold
  95.       TotalRetail& = TotalRetail& + ExtRetail&
  96.       TotalCost& = TotalCost& + ExtCost&
  97.       NextSalesMix
  98.       t% = DoEvents()
  99.     Loop Until SalesMixSt% <> 0 Or PrintCancelFlag = True
  100.     DollarProfit@ = (TotalRetail& - (TotalCost& / 100)) / 100
  101.    'Begin Second Pass
  102.     GoSub PrintHeading
  103.     t% = DoEvents()
  104.     FirstSalesMix
  105.     If SalesMixSt% <> 0 Then
  106.       MsgUnknownSalesMixError
  107.     End If
  108.     Do
  109.       If Printer.CurrentY > MaximumY& Then
  110.         Printer.NewPage
  111.         GoSub PrintHeading
  112.       End If
  113.       ExtCost& = 0
  114.       ExtRetail& = 0
  115.       RecipeCost = 0
  116.       RecipeRec.RecNo = SalesMixRec.RecNo
  117.       ReadRecipe
  118.       'Get lines of ingredients
  119.       RecipeDetRec.RecDetKey = RecipeRec.RecNo + String$(15, "0")
  120.       GetGERecipeDet
  121.       If RecipeDetSt% <> 9 And RecipeDetSt% <> 0 Then
  122.         MsgUnknownRecipeDetError
  123.         GoTo ExitProgram
  124.       End If
  125.       Do Until RecipeDetSt% <> 0 Or RecipeDetRec.RecDetKey > RecipeRec.RecNo + String$(15, "Z")
  126.           IngredientRec.IngKey = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  127.           ReadIngredient
  128.           If IngredientSt% = 0 Then
  129.             PrIngred$ = Mid$(RecipeDetRec.RecDetKey, 7, 15)
  130.             PrNoUnits# = RecipeDetRec.RecDetQty
  131.             GoSub ProcessOneIngredient
  132.           End If
  133.           t% = DoEvents()
  134.           NextRecipeDet
  135.       Loop
  136.       Printer.Print SalesMixRec.RecNo;
  137.       Printer.Print Tab(8); RecipeRec.RecDesc;
  138.       ExtRetail& = RecipeRec.RecRetail * SalesMixRec.ServingsSold
  139.       Temp1$ = Format$((RecipeRec.RecRetail / 100), "##0.00")
  140.       Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
  141.       Printer.Print Tab(40); Temp1$;
  142.       UnitCost& = RecipeCost / RecipeRec.Servings
  143.       ExtCost& = UnitCost& * SalesMixRec.ServingsSold
  144.       Temp1$ = Format$((UnitCost& / 10000), "##0.0000")
  145.       Temp1$ = String$(8 - Len(Temp1$), " ") + Temp1$
  146.       Printer.Print Tab(48); Temp1$;
  147.       Temp1$ = Format$(SalesMixRec.ServingsSold, "####0")
  148.       Temp1$ = String$(5 - Len(Temp1$), " ") + Temp1$
  149.       Printer.Print Tab(58); Temp1$;
  150.       Temp1$ = Format$((ExtRetail& / 100), "#####0.00")
  151.       Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  152.       Printer.Print Tab(65); Temp1$;
  153.       Temp1$ = Format$((ExtCost& / 10000), "#####0.0000")
  154.       Temp1$ = String$(11 - Len(Temp1$), " ") + Temp1$
  155.       Printer.Print Tab(76); Temp1$;
  156.       Temp1$ = Format$(((ExtRetail& / 100) - (ExtCost& / 10000)), "#####0.00")
  157.       Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  158.       Printer.Print Tab(89); Temp1$;
  159.       PctSales@ = (ExtRetail& / TotalRetail&) * 100
  160.       Temp1$ = Format$(PctSales@, "###.00")
  161.       Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
  162.       Printer.Print Tab(100); Temp1$;
  163.       PctProfit@ = ((ExtRetail& - (ExtCost& / 100)) / (DollarProfit@ * 100)) * 100
  164.       Temp1$ = Format$(PctProfit@, "###.00")
  165.       Temp1$ = String$(6 - Len(Temp1$), " ") + Temp1$
  166.       Printer.Print Tab(108); Temp1$
  167.       NextSalesMix
  168.       t% = DoEvents()
  169.     Loop Until SalesMixSt% <> 0 Or PrintCancelFlag = True
  170.     GoSub PrintTotals
  171.     GoTo ExitProgram
  172.     Exit Sub
  173. PrintHeading:
  174.     PageNo% = PageNo% + 1
  175.     Printer.Print "Projected Sales Mix Profitability Report"; Tab(55); Date$; Tab(85); "Page "; PageNo%
  176.     Printer.Print Tab(66); "Extended     Extended     Dollar    % of    % of"
  177.     Printer.Print "Recipe# Description"; Tab(40); "Retail      Cost   Sold     Retail         Cost     Profit   Sales  Profit"
  178.     Printer.Print String$(113, "-")
  179.     Return
  180. ProcessOneIngredient:
  181.     IngredientRec.IngKey = PrIngred$
  182.     ReadIngredient
  183.     CostPerUnit& = IngredientRec.IngCaseCost / IngredientRec.IngUnitsPerCase
  184.     IngredientCost = (CostPerUnit& * PrNoUnits#)
  185.     RecipeCost = RecipeCost + IngredientCost
  186.     Return
  187. PrintTotals:
  188.     Printer.Print String$(113, "-")
  189.     PctProfit@ = ((TotalRetail& - (TotalCost& / 100)) / TotalRetail&) * 100
  190.     Printer.Print "Total menu profit percent = "; Format$(PctProfit@, "##0.00"); "%";
  191.     Temp1$ = Format$((TotalRetail& / 100), "#####0.00")
  192.     Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  193.     Printer.Print Tab(65); Temp1$;
  194.     Temp1$ = Format$((TotalCost& / 10000), "#####0.0000")
  195.     Temp1$ = String$(11 - Len(Temp1$), " ") + Temp1$
  196.     Printer.Print Tab(76); Temp1$;
  197.     Temp1$ = Format$(DollarProfit@, "#####0.00")
  198.     Temp1$ = String$(9 - Len(Temp1$), " ") + Temp1$
  199.     Printer.Print Tab(89); Temp1$
  200.     Return
  201. ErrorRoutine:
  202.     Resume ExitProgram
  203. ExitProgram:
  204.     Printer.EndDoc
  205.     Unload SalesMix
  206. End Sub
  207.